package com.blog.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.blog.service.entity.Role;
import com.blog.service.inter.RoleService;
import com.blog.service.model.RoleMapper;

/**
 * 文件名： com.blog.service.impl.RoleServiceImpl.java
 * 作者： WenBin
 * 日期： 2017年4月12日
 * 功能说明： 角色服务类
 * =========================================================
 * 修改记录：
 * 修改作者 日期 修改内容
 * =========================================================
 * Copyright (c) 2010-2011 .All rights reserved.
 */
@Service
public class RoleServiceImpl implements RoleService {

	@Autowired
	private RoleMapper roleMapper;

	@Override
	public Role findRoleByPk(String pk) {

		Role role = roleMapper.selectByPrimaryKey(pk);
		return role;
	}

	@Override
	public Role saveRole(Role role) {

		int i = roleMapper.insertSelective(role);
		if (i > 0) {
			return role;
		}
		return null;
	}

	@Override
	public Role updateRole(Role role) {

		int i = roleMapper.updateByPrimaryKey(role);
		if (i > 0) {
			return role;
		}
		return null;
	}

}
